# eric7.WebBrowser.Bookmarks.BookmarksManager

Module implementing the bookmarks manager.

### Global Attributes

BOOKMARKBAR
BOOKMARKMENU

### Classes

BookmarkSearchStart | Class defining the start points for bookmark searches.
BookmarksManager | Class implementing the bookmarks manager.
ChangeBookmarkCommand | Class implementing the Insert undo command.
InsertBookmarksCommand | Class implementing the Insert undo command.
RemoveBookmarksCommand | Class implementing the Remove undo command.

### Functions

None

## BookmarkSearchStart

Class defining the start points for bookmark searches.

### Derived from

enum.Enum

### Class Attributes

Menu
Root
ToolBar

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## BookmarksManager

Class implementing the bookmarks manager.

### Signals

bookmarksReloaded()
  emitted after the bookmarks were reloaded
bookmarksSaved()
  emitted after the bookmarks were saved
entryAdded(BookmarkNode)
  emitted after a bookmark node has been added
entryChanged(BookmarkNode)
  emitted after a bookmark node has been changed
entryRemoved(BookmarkNode, int, BookmarkNode)
  emitted after a bookmark node has been removed

### Derived from

QObject

### Class Attributes

None

### Class Methods

getFileName | Class method to get the file name of the bookmark file.

### Methods

BookmarksManager | Constructor
__initialize | Private method to initialize some data.
__searchBookmark | Private method get a bookmark node for a given URL.
__searchBookmarks | Private method get a list of bookmark nodes for a given URL.
addBookmark | Public method to add a bookmark.
bookmarkForUrl | Public method to get a bookmark node for a given URL.
bookmarks | Public method to get a reference to the root bookmark node.
bookmarksForUrl | Public method to get a list of bookmark nodes for a given URL.
bookmarksModel | Public method to get a reference to the bookmarks model.
changeExpanded | Public method to handle a change of the expanded state.
close | Public method to close the bookmark manager.
exportBookmarks | Public method to export the bookmarks.
faviconChanged | Public slot to update the icon image for an URL.
importBookmarks | Public method to import bookmarks.
incVisitCount | Public method to increment the visit count of a bookmark.
load | Public method to load the bookmarks.
menu | Public method to get a reference to the bookmarks menu node.
reload | Public method used to initiate a reloading of the bookmarks.
removeBookmark | Public method to remove a bookmark.
save | Public method to save the bookmarks.
setNodeChanged | Public method to signal changes of bookmarks other than title, URL or timestamp.
setTimestamp | Public method to set the URL of a bookmark.
setTitle | Public method to set the title of a bookmark.
setUrl | Public method to set the URL of a bookmark.
setVisitCount | Public method to set the visit count of a bookmark.
toolbar | Public method to get a reference to the bookmarks toolbar node.
undoRedoStack | Public method to get a reference to the undo stack.

### Static Methods

None

#### BookmarksManager.getFileName (class method)

getFileName()

Class method to get the file name of the bookmark file.

Return:
  name of the bookmark file

Return Type:
  str

#### BookmarksManager (Constructor)

BookmarksManager(parent=None)

Constructor

parent (QObject)
  reference to the parent object

#### BookmarksManager.__initialize

__initialize()

Private method to initialize some data.

#### BookmarksManager.__searchBookmark

__searchBookmark(url, startNode)

Private method get a bookmark node for a given URL.

url (str)
  URL of the bookmark to search for
startNode (BookmarkNode)
  reference to the node to start searching

Return:
  bookmark node for the given url

Return Type:
  BookmarkNode

#### BookmarksManager.__searchBookmarks

__searchBookmarks(url, startNode)

Private method get a list of bookmark nodes for a given URL.

url (str)
  URL of the bookmarks to search for
startNode (BookmarkNode)
  reference to the node to start searching

Return:
  list of bookmark nodes for the given url

Return Type:
  list of BookmarkNode

#### BookmarksManager.addBookmark

addBookmark(parent, node, row=-1)

Public method to add a bookmark.

parent (BookmarkNode)
  reference to the node to add to
node (BookmarkNode)
  reference to the node to add
row (int)
  row number

#### BookmarksManager.bookmarkForUrl

bookmarkForUrl(url, start=BookmarkSearchStart.Root)

Public method to get a bookmark node for a given URL.

url (QUrl or str)
  URL of the bookmark to search for
start (BookmarkSearchStart)
  indicator for the start of the search

Return:
  bookmark node for the given url

Return Type:
  BookmarkNode

#### BookmarksManager.bookmarks

bookmarks()

Public method to get a reference to the root bookmark node.

Return:
  reference to the root bookmark node

Return Type:
  BookmarkNode

#### BookmarksManager.bookmarksForUrl

bookmarksForUrl(url, start=BookmarkSearchStart.Root)

Public method to get a list of bookmark nodes for a given URL.

url (QUrl or str)
  URL of the bookmarks to search for
start (BookmarkSearchStart)
  indicator for the start of the search

Return:
  list of bookmark nodes for the given url

Return Type:
  list of BookmarkNode

#### BookmarksManager.bookmarksModel

bookmarksModel()

Public method to get a reference to the bookmarks model.

Return:
  reference to the bookmarks model

Return Type:
  BookmarksModel

#### BookmarksManager.changeExpanded

changeExpanded()

Public method to handle a change of the expanded state.

#### BookmarksManager.close

close()

Public method to close the bookmark manager.

#### BookmarksManager.exportBookmarks

exportBookmarks()

Public method to export the bookmarks.

#### BookmarksManager.faviconChanged

faviconChanged(url)

Public slot to update the icon image for an URL.

url (QUrl or str)
  URL of the icon to update

#### BookmarksManager.importBookmarks

importBookmarks()

Public method to import bookmarks.

#### BookmarksManager.incVisitCount

incVisitCount(node)

Public method to increment the visit count of a bookmark.

node (BookmarkNode)
  reference to the node to be changed

#### BookmarksManager.load

load()

Public method to load the bookmarks.

Raises RuntimeError:
  raised to indicate an error loading the bookmarks

#### BookmarksManager.menu

menu()

Public method to get a reference to the bookmarks menu node.

Return:
  reference to the bookmarks menu node

Return Type:
  BookmarkNode

#### BookmarksManager.reload

reload()

Public method used to initiate a reloading of the bookmarks.

#### BookmarksManager.removeBookmark

removeBookmark(node)

Public method to remove a bookmark.

node (BookmarkNode)
  reference to the node to be removed

#### BookmarksManager.save

save()

Public method to save the bookmarks.

#### BookmarksManager.setNodeChanged

setNodeChanged()

Public method to signal changes of bookmarks other than title, URL or timestamp.

#### BookmarksManager.setTimestamp

setTimestamp(node, timestampType, timestamp)

Public method to set the URL of a bookmark.

node (BookmarkNode)
  reference to the node to be changed
timestampType (BookmarkTimestampType)
  type of the timestamp to set
timestamp (QDateTime)
  timestamp to set

#### BookmarksManager.setTitle

setTitle(node, newTitle)

Public method to set the title of a bookmark.

node (BookmarkNode)
  reference to the node to be changed
newTitle (str)
  title to be set

#### BookmarksManager.setUrl

setUrl(node, newUrl)

Public method to set the URL of a bookmark.

node (BookmarkNode)
  reference to the node to be changed
newUrl (str)
  URL to be set

#### BookmarksManager.setVisitCount

setVisitCount(node, count)

Public method to set the visit count of a bookmark.

node (BookmarkNode)
  reference to the node to be changed
count (int or str)
  visit count to be set

#### BookmarksManager.toolbar

toolbar()

Public method to get a reference to the bookmarks toolbar node.

Return:
  reference to the bookmarks toolbar node

Return Type:
  BookmarkNode

#### BookmarksManager.undoRedoStack

undoRedoStack()

Public method to get a reference to the undo stack.

Return:
  reference to the undo stack

Return Type:
  QUndoStack

Up

## ChangeBookmarkCommand

Class implementing the Insert undo command.

### Derived from

QUndoCommand

### Class Attributes

None

### Class Methods

None

### Methods

ChangeBookmarkCommand | Constructor
redo | Public slot to perform the redo action.
undo | Public slot to perform the undo action.

### Static Methods

None

#### ChangeBookmarkCommand (Constructor)

ChangeBookmarkCommand(bookmarksManager, node, newValue, title)

Constructor

bookmarksManager (BookmarksManager)
  reference to the bookmarks manager
node (BookmarkNode)
  reference to the node to be changed
newValue (str)
  new value to be set
title (bool)
  flag indicating a change of the title (True) or the URL (False)

#### ChangeBookmarkCommand.redo

redo()

Public slot to perform the redo action.

#### ChangeBookmarkCommand.undo

undo()

Public slot to perform the undo action.

Up

## InsertBookmarksCommand

Class implementing the Insert undo command.

### Derived from

RemoveBookmarksCommand

### Class Attributes

None

### Class Methods

None

### Methods

InsertBookmarksCommand | Constructor
redo | Public slot to perform the redo action.
undo | Public slot to perform the undo action.

### Static Methods

None

#### InsertBookmarksCommand (Constructor)

InsertBookmarksCommand(bookmarksManager, parent, node, row)

Constructor

bookmarksManager (BookmarksManager)
  reference to the bookmarks manager
parent (BookmarkNode)
  reference to the parent node
node (BookmarkNode)
  reference to the node to be inserted
row (int)
  row number of bookmark

#### InsertBookmarksCommand.redo

redo()

Public slot to perform the redo action.

#### InsertBookmarksCommand.undo

undo()

Public slot to perform the undo action.

Up

## RemoveBookmarksCommand

Class implementing the Remove undo command.

### Derived from

QUndoCommand

### Class Attributes

None

### Class Methods

None

### Methods

RemoveBookmarksCommand | Constructor
redo | Public slot to perform the redo action.
undo | Public slot to perform the undo action.

### Static Methods

None

#### RemoveBookmarksCommand (Constructor)

RemoveBookmarksCommand(bookmarksManager, parent, row)

Constructor

bookmarksManager (BookmarksManager)
  reference to the bookmarks manager
parent (BookmarkNode)
  reference to the parent node
row (int)
  row number of bookmark

#### RemoveBookmarksCommand.redo

redo()

Public slot to perform the redo action.

#### RemoveBookmarksCommand.undo

undo()

Public slot to perform the undo action.

Up